﻿/*
* @autor: hectorea
* @date: 01/08/2012
* @programming interview 12
*/

namespace SumDigitsOfANumber
{
   internal static class IntExtension
    {
       
       public static int SumDigits(this int number)
       {         
           int result;

           do
           {
               result = 0;

               while (number > 0)
               {
                   result += number % 10;
                   number /= 10;
               }

               number = result;

           } while (number > 10);
           

           return result;
       }
    }
}
